import { Entity, Column, PrimaryGeneratedColumn, OneToOne, JoinColumn } from "typeorm";
import { Photo } from "./photo.entity";
import { BaseEntity } from "./base.entity";


@Entity()
export class PhotoMetadata  extends BaseEntity {
  
  @PrimaryGeneratedColumn()
  id ?: number;

  
  @Column("int")
  height ?: number;

  
  @Column("int")
  width ?: number;

  
  @Column({
    nullable: true
  })
  orientation ?: string;

  
  @Column({
    nullable: true
  })
  compressed ?: boolean;

  
  @Column({
    nullable: true
  })
  comment ?: string;

  
  @OneToOne(() => Photo, photo => photo.metadata, {
    cascade: ['insert', 'recover', 'update'],
  })
  @JoinColumn()
  photo ?: Photo;
}